import 'package:flutter/material.dart';
import 'package:get/get.dart';

import '../index.dart';
import 'widgets.dart';

class PwdLogin extends GetView<LoginController> {
  final VoidCallback onLogin;
  final VoidCallback onCodeLogin;
  final VoidCallback onEazyLogin;

  const PwdLogin({
    Key? key,
    required this.onLogin,
    required this.onCodeLogin,
    required this.onEazyLogin,
  }) : super(key: key);

  @override
  Widget build(BuildContext context) {
    return Column(
      children: [
        const LoginTitle('密码登录'),
        const SizedBox(height: 50),
        CustomInput(
          controller: controller.state.mobileController,
          hintText: '输入手机号',
          keyboardType: TextInputType.phone,
        ),
        const SizedBox(height: 10),
        CustomInput(
          controller: controller.state.pwdController,
          hintText: '输入密码',
          obscureText: true,
          keyboardType: TextInputType.text,
        ),
        const SizedBox(height: 50),
        LoginBtn(
          text: '登录',
          onPressed: onLogin,
        ),
        const SizedBox(height: 20),
        Row(
          mainAxisAlignment: MainAxisAlignment.spaceBetween,
          children: [
            LoginTextBtn(
              text: '一键登录',
              onPressed: onEazyLogin,
            ),
            LoginTextBtn(
              text: '手机登录',
              onPressed: onCodeLogin,
            ),
          ],
        ),
      ],
    );
  }
}
